//fix drag issue: dialog's bottom edge is cut by the browser bottom edge
$.extend($.ui.dialog.prototype,{
  _makeDraggable: function() {
		var self = this,
			options = this.options,
			heightBeforeDrag;

		this.uiDialog.draggable({
			cancel: '.ui-dialog-content',
			handle: '.ui-dialog-titlebar',
			containment: options['containment'] || 'document', //make containment customizable
			start: function() {
				heightBeforeDrag = options.height;
				$(this).height($(this).height()).addClass("ui-dialog-dragging");
				(options.dragStart && options.dragStart.apply(self.element[0], arguments));
			},
			drag: function() {
				(options.drag && options.drag.apply(self.element[0], arguments));
			},
			stop: function() {
				$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
				(options.dragStop && options.dragStop.apply(self.element[0], arguments));
				$.ui.dialog.overlay.resize();
			}
		});
	}
})

// Hide help icon for release 2
/**
function HelpDialog(dom) {
    this._dom = dom;
    this._indexView= this._dom.find("#index-view");
    this._detailView = this._dom.find("#detail-view");
    this._linkToContent = this._detailView.find(".link-to-content");
    this._helpDialogClass = "help-dialog-wrapper";
}

HelpDialog.prototype = {
    createDialog: function() {
        var me = this;
        this._dom.dialog({
            containment: 'window',
            bgiframe: true,
            autoOpen: false,
            modal: false,
            draggable: true,
            dialogClass: me._helpDialogClass,
            width: 350,
            height: 400,
            title: i18n('CALENDAR_HELP_TITLE'),
            beforeclose: function() {
            }
        });
        $("#help_tabs").tabs();
        this._bindEvents();
    },

    showDialog: function(helpIconRightBottomOffset) {
        this._resetDialog();
        this._dom.dialog('open');
        this._setStyle(helpIconRightBottomOffset);
    },

    _resetDialog: function() {
        this._expandAllGroups();
        this._backToIndexView();
    },

    _expandAllGroups: function() {
        this._indexView.find(".group-name").removeClass('collapse');
        this._indexView.find(".help-items").removeClass('hidden');
    },

    _setStyle: function(helpIconRightBottomOffset) {
        this._dom.parent().css('left', helpIconRightBottomOffset.left - this._dom.width());
        this._dom.parent().css('top', helpIconRightBottomOffset.top);
        $('.' + this._helpDialogClass).css('z-index', CalendarZIndexManager.helpZIndex);
    },

    _bindEvents: function() {
        var me = this;

        this._bindGroupNameClickEvent();
        this._bindQuestionClickEvent();
        this._bindGoToContentEvent();
    },

    _bindGroupNameClickEvent: function() {
        var me = this;
        var groups = this._dom.find(".group-item .group-name");
        groups.click(function() {
            me._toggleQuestionList($(this));
        });
    },
    _bindQuestionClickEvent: function() {
        var me = this;
        this._dom.find(".question").click(function() {
            me._hideIndexView();
            me._showDetailView($(this));
        });
    },
    _bindGoToContentEvent: function() {
        var me = this;
        this._linkToContent.click(function() {
            me._backToIndexView();

        });
    },

    _backToIndexView: function() {
        this._hideDetailView();
        this._showIndexView();
    },

    _toggleQuestionList: function(trigger) {
        var questionList = trigger.parent().children(".help-items");
        questionList.toggleClass("hidden");
        if (questionList.hasClass("hidden")) {
            trigger.addClass("collapse");
        } else {
            trigger.removeClass("collapse");
        }
    },

    _hideIndexView: function() {
        this._indexView.addClass('hidden');
    },

    _showIndexView: function() {
        this._indexView.removeClass('hidden');
    },

    _hideDetailView: function() {
        this._detailView.addClass('hidden');
    },

    _showDetailView: function(questionNameElement) {
        var answerContainer = this._detailView.find('.answer-container');
        answerContainer.html("");
        answerContainer.append(questionNameElement.parent().children().clone());
        answerContainer.find(".answer").removeClass('hidden');
        this._detailView.removeClass('hidden');
    }
};
*/